package org.mercworks.igamexmlparser.util;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

import org.mercworks.knightgame.model.KnightGameModel;

public abstract class ModelExporter
{
	/**
	 * Uses an object output stream to serialize the top-level model object to a file.
	 * The object is output to the given filename.  This path is an absolute path to location
	 * of the file destination.
	 * @param fileName the <code>String</code> representation of the absolute path of the
	 * file destination
	 */
	
	public static void exportModel(KnightGameModel kgModel) throws Exception
	{
		// Write to disk with FileOutputStream
		FileOutputStream fileOut = new FileOutputStream("F:/Docume~1/bobatronx/Desktop/box.kgm");

		// Write object with ObjectOutputStream
		ObjectOutputStream objectOut = new ObjectOutputStream(fileOut);

		// Write object out to disk
		objectOut.writeObject(kgModel);
		
		objectOut.close();
		fileOut.close();
	}
}
